<template>
	<view class="content">
     <top-tabs :tabs="tabs" @changeTab="changeTab"/>
		<view  class="index-cont">
			<template v-if="hasLogin == false || (hasLogin && userInfo.memberRole == 0)">
       	<!-- <view class="m-position">
        <view class="item" v-for="(item, index) in list" :key="index">
          <view class="user" @click="gotoPer(item)">
            <view class="left">
              <image :src="$mConfig.imageUrl + '/image/per1.png'" ></image>
              <view class="left-right">
                <view>
                  <text class="name">张潇潇</text>
                  <text class="post gray">运营负责人</text>
                </view>
              <view class="user-cont">
                <text class="gray">女</text>
                <text>10年以上经验</text>
                <text>本科</text>
                <text>34岁</text>
                </view>
              </view>
            </view>
              <text class="yzb yzb-next icon-next"></text>
          </view>
           <view class="title space-between">
            <view class="left">
              <view class="title-name">
              太原市公司招聘一线普工（无需 经验)
              </view>
            </view>
            <text class="right">300/天 </text>
          </view>
          <view class="desc">
            <text class="blue">企业认证</text>
            <text>经验不限</text>
            <text class="blue">月结工资</text>
            <text class="blue">五险一金</text>
          </view>
          <view class="descr">招聘单位：山西博才人力资源管理有限公司</view>
         
        </view>
	  </view> -->
    <user-list fromType="2" :rightArrow="true">
         <view class="btns-box">
             <view class="red" >拒绝面试</view>
             <view class="blue">提交招聘公司</view>
            
             <!-- <view class="blue" v-if="item.type==2">邀请面试</view>
             <view v-if="item.type==2">取消面试</view>
             <view v-if="item.type==2">删除</view> -->
          </view>
    </user-list>
			</template>
			<view class="load-more-box">
				<uni-load-more v-if="status == '请求中'" status="正在加载..." :showIcon="true"></uni-load-more>
				<uni-load-more v-if="status == '没有更多'" status="没有更多了" :showIcon="false"></uni-load-more>
				<uni-load-more v-if="status == '暂无数据'" status="暂无数据" :showIcon="false"></uni-load-more>
				<uni-load-more v-if="status == '请求失败'" status="加载失败，点我重试" :showIcon="false"
					@click="reLoad"></uni-load-more>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters
	} from 'vuex';
	import yzbPosition from '@/components/yzb/yzb-position.vue';
	import IMService from '@/lib/imservice';
	export default {
		components: {
			yzbPosition,
		},
		computed: {
			...mapState(['userInfo']),
			...mapGetters(['hasLogin'])
		},
		data() {
			return {
				statusBarHeight: 0,
				navBarHeight: 0,
				topHeight: 0,
        tabs:[
          {label:'待确认',value:1},
          {label:'待面试',value:2},
          {label:'待报到',value:3},
          {label:'面试失败',value:4},
        ],
        selectTab:1,
				status: '',
				query: {
					page: 1,
					limit: 10
				},
				banner: [],
				grid: [],
				ka: [],
				JobExpectList: [],
				list: [{
          type:1
        },{
          type:2
        }],
				selectExpected: null,
				key: '102dcab15e743584f73d383dea7530e7', //高德地图key
				location: {
					city: '未定位'
				}, //定位信息

				loadStatus: 'loading', //loading、fail、success
        noticeList: [],
        companyList:[{
          companyName:'山西洪城运至科技有限公司'
        },{
          companyName:'山西小米科技有限公司'
        }]
			};
		},
		created() {
			//获取手机状态栏高度
			// this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
			//#ifdef MP-WEIXIN
			// this.navBarHeight = uni.getMenuButtonBoundingClientRect().bottom;
			// this.topHeight = this.navBarHeight + uni.upx2px(80);
			//#endif
			uni.getSystemInfo({
				success: (e) => {
					// this.compareVersion(e.SDKVersion, '2.5.0')
					let statusBar = 0 //状态栏高度
					let customBar = 0 // 状态栏高度 + 导航栏高度  
					let navbar = 0 // 自定义标题与胶囊对齐高度

					// #ifdef MP
					statusBar = e.statusBarHeight
					customBar = e.statusBarHeight + 45
					if (e.platform === 'android') {
						this.$store.commit('SET_SYSTEM_IOSANDROID', false)
						customBar = e.statusBarHeight + 50
					}
					// #endif

					// #ifdef MP-WEIXIN
					statusBar = e.statusBarHeight
					const custom = wx.getMenuButtonBoundingClientRect()
					customBar = custom.bottom + custom.top - e.statusBarHeight
          // navbar = (custom.top - e.statusBarHeight) * 2 + custom.height
          navbar = 20
					// #endif

					// #ifdef MP-ALIPAY
					statusBar = e.statusBarHeight
					customBar = e.statusBarHeight + e.titleBarHeight
					// #endif

					// #ifdef APP-PLUS
					console.log('app-plus', e)
					statusBar = e.statusBarHeight
					customBar = e.statusBarHeight + 45
					// #endif

					// #ifdef H5
					statusBar = 0
					customBar = e.statusBarHeight + 45
					// #endif

					this.statusBarHeight = statusBar;
					// #ifdef MP-WEIXIN
					this.navBarHeight = navbar;
					// #endif
					// #ifndef MP-WEIXIN
					this.navBarHeight = customBar;
					// #endif
					this.topHeight = this.navBarHeight + uni.upx2px(194);

				}
			})

		},
		async onLoad(query) {
      console.log(query,'query')
			await this.$AppEntryController.main(query);
			let loc = this.$db.get('location');
			console.log('loc===', loc);
			if (loc) {
				this.location = loc;
			}
			//#ifdef MP-WEIXIN
			this.locationAuth();
			//#endif
			//#ifdef H5
			this.getPosition();
			//#endif
			
			//#ifdef APP-PLUS
			this.getLocation();
			//#endif

			this.listenCitySelect();
		},

		onShow() {
			if (this.hasLogin && this.userInfo.memberRole == 1) {
				this.roleChange();
			}
			// this.getDatasByLoc();
			this.initChat();
		},

		onPullDownRefresh() {
			this.getDatasByLoc('refresh', true);
		},

		onReachBottom() {
			this.getDatasByLoc('add');
		},
		methods: {

			positionDetail(item) {
				this.$mRouter.push({
					route: this.$mRoutesConfig.positionDetail,
					query: {
						id: item.id
					}
				});
      },
      call(phone){
			console.log("拨打电话：",phone);
			uni.makePhoneCall({
				phoneNumber:phone
			})
		},

			gotoPer(item) {
				console.log('goItem', item);
				uni.navigateTo({
					url:`/pages/user/person/resume`
				})
			},

			goMore(item) {
				console.log('goMore', item);
				this.$mRouter.push({
					route: this.$mRoutesConfig.notices
				});
      },
      changeTab(item){
        this.selectTab=item
      },

		}
	};
</script>
<style>
page{
  background: #F5F5FC;
}
</style>
<style lang="scss" scoped>
.index-cont{
  background: #F3F5FA;
  padding: 20rpx 20rpx;
}
  .btns-box{
    display: flex;
    margin-top: 44rpx;
    justify-content: flex-end;
    view{
      background: #EDEDED;
      color: #888888;
      font-size: 28rpx;
      line-height: 58rpx;
      border-radius: 10rpx;
      margin-left: 22rpx;
      padding: 0 24rpx;
    }
    .blue{
      background: #3A92FF;
      color: #fff;
    }
    .red{
      background: #FB7979;
      color: #fff;
    }
  }
.space-between {
	display: flex;
	justify-content: space-between;
	flex-direction: row;
}
.title {
  padding: 44rpx 0 26rpx;
   font-weight: 600;
	.title-name{
    font-size: $uni-font-size-lg !important;
    color: #111;
	}
.right{
  color: #348FFF;
   font-size: $uni-font-size-lg !important;
}
}

.descr{
  color: #222;
  font-size: 28rpx;
  margin-top: 26rpx;
}

</style>